<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of tt_mv</title>
  <meta name="keywords" content="tt_mv">
  <meta name="description" content="Matrix-by-vector product in the TT1.0 format">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../index.html">Home</a> &gt;  <a href="#">tt2</a> &gt; <a href="index.html">core</a> &gt; tt_mv.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../../index.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for tt2/core&nbsp;<img alt=">" border="0" src="../../right.png"></a></td></tr></table>-->

<h1>tt_mv
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>Matrix-by-vector product in the TT1.0 format</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function [res]=tt_mv(mat,vec) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment">Matrix-by-vector product in the TT1.0 format
   [RES]=TT_MV(MAT,VEC) matrix MAT by vector VEC product in TT1.0 format
   Please avoid its usage: it will be removed in
   future releases. Use * operator from the object-oriented version


 TT-Toolbox 2.2, 2009-2012

This is TT Toolbox, written by Ivan Oseledets et al.
Institute of Numerical Mathematics, Moscow, Russia
webpage: http://spring.inm.ras.ru/osel

For all questions, bugs and suggestions please mail
ivan.oseledets@gmail.com
---------------------------
ZAGLUSHKA TMP
res=tt_mvk2(mat,vec,1e-4);</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>	Mode sizes of the TT-matrix</li><li><a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>	Reshape of the TT-tensor</li><li><a href="../../tt2/@tt_tensor/size.html" class="code" title="function [sz] = size(tt,dim)">size</a>	Mode sizes of the TT-tensor</li></ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="tt_qcirc.html" class="code" title="function [tt]=tt_qcirc(x,d)">tt_qcirc</a>	returns the multilevel circulant matrix tt generated by the multi-dimensional input vector x</li><li><a href="tt_qltrtoepl.html" class="code" title="function [tt]=tt_qltrtoepl(x)">tt_qltrtoepl</a>	returns the multilevel lower-triangular Toeplitz matrix tt generated by the multi-dimensional input vector x</li><li><a href="tt_qtoepl.html" class="code" title="function [tt]=tt_qtoepl(x,d)">tt_qtoepl</a>	returns the multilevel Toeplitz matrix tt generated by the multi-dimensional input vector x</li><li><a href="tt_qutrtoepl.html" class="code" title="function [tt]=tt_qltrtoepl(x)">tt_qutrtoepl</a>	returns the multilevel upper-triangular Toeplitz matrix tt generated by the multi-dimensional input vector x</li><li><a href="../../tt2/misc/tt_Fd_mtx1.html" class="code" title="function [M] = tt_Fd_mtx1(tt_a, bound1, bound2, eps)">tt_Fd_mtx1</a>	Generates finite-difference 1D matrix of \nabla(tt_a \nabla) in QTTM format.</li><li><a href="../../tt2/solve/dmrg_rake_solve2.html" class="code" title="function [x]=dmrg_rake_solve2(A, y, tol, varargin)">dmrg_rake_solve2</a>	DMRG-type method for the solution of linear systems in QTT-Tucker format</li><li><a href="../../tt2/solve/dmrg_solve2.html" class="code" title="function [x, sweeps]=dmrg_solve2(A, y, eps,varargin)">dmrg_solve2</a>	Solution of linear systems in TT-format via DMRG iteration</li><li><a href="../../tt2/solve/tt_iterapp.html" class="code" title="function y = tt_iterapp(op,afun,atype,afcnstr,x,eps,max_rank,max_swp,varargin)">tt_iterapp</a>	Apply TT matrix operator to TT vector and error gracefully.</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [res]=tt_mv(mat,vec)</a>
0002 <span class="comment">%Matrix-by-vector product in the TT1.0 format</span>
0003 <span class="comment">%   [RES]=TT_MV(MAT,VEC) matrix MAT by vector VEC product in TT1.0 format</span>
0004 <span class="comment">%   Please avoid its usage: it will be removed in</span>
0005 <span class="comment">%   future releases. Use * operator from the object-oriented version</span>
0006 <span class="comment">%</span>
0007 <span class="comment">%</span>
0008 <span class="comment">% TT-Toolbox 2.2, 2009-2012</span>
0009 <span class="comment">%</span>
0010 <span class="comment">%This is TT Toolbox, written by Ivan Oseledets et al.</span>
0011 <span class="comment">%Institute of Numerical Mathematics, Moscow, Russia</span>
0012 <span class="comment">%webpage: http://spring.inm.ras.ru/osel</span>
0013 <span class="comment">%</span>
0014 <span class="comment">%For all questions, bugs and suggestions please mail</span>
0015 <span class="comment">%ivan.oseledets@gmail.com</span>
0016 <span class="comment">%---------------------------</span>
0017 <span class="comment">%ZAGLUSHKA TMP</span>
0018 <span class="comment">%res=tt_mvk2(mat,vec,1e-4);</span>
0019 d=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat,1);
0020 res=cell(d,1);
0021 n=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat{1},1);
0022 m=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat{1},2);
0023 rm1=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat{1},3);
0024 rv1=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(vec{1},2);
0025 <span class="comment">%mat{1} is (n x m x rm1 , vec{1} is mxrv1)</span>
0026 <span class="comment">%            n x rm1 x rv1</span>
0027 res{1}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(permute(mat{1},[1,3,2]),[n*rm1,m])*vec{1};
0028 res{1}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(permute(<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(res{1},[n,rm1,rv1]),[1,3,2]),[n,rv1*rm1]);
0029 n=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat{d},1);
0030 m=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat{d},2);
0031 rm1=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat{d},3);
0032 rv1=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(vec{d},2);
0033 <span class="comment">%mat{1} is (n x rm1 x rv1 , vec{1} is mxrv1)</span>
0034 res{d}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(permute(mat{d},[1,3,2]),[n*rm1,m])*vec{d};
0035 res{d}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(permute(<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(res{d},[n,rm1,rv1]),[1,3,2]),[n,rv1*rm1]);
0036 <span class="keyword">for</span> i=2:d-1
0037     n=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat{i},1);
0038     m=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat{i},2);
0039     rm1=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat{i},3);
0040     rm2=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat{i},4);
0041     rv1=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(vec{i},2);
0042     rv2=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(vec{i},3);
0043     <span class="comment">%mat{i} is n x m x rm1 x rm2, vec{i} is m x rv1 x rv2</span>
0044     <span class="comment">%n x (rv1*rv2)*rm1*rm2</span>
0045     <span class="comment">%n x rm2 x rm1 x m, n x rm2 x rm1 x (rv1*rv2)</span>
0046     <span class="comment">%n x rm2 x rmx1 x rv1 x rv2</span>
0047     <span class="comment">%want: n x rv1*rm1 x rv2*rm2</span>
0048     res{i}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(permute(mat{i},[1,4,3,2]),[n*rm2*rm1,m])*<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(vec{i},[m,rv1*rv2]);
0049     res{i}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(res{i},[n,rm2,rm1,rv1,rv2]);
0050     res{i}=permute(res{i},[1,4,3,5,2]);
0051     res{i}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(res{i},[n,rv1*rm1,rv2*rm2]);
0052     <span class="comment">%res{i}=permute(reshape(permute(mat{i},[1,3,4,2])*reshape(vec{i},[m,rv1*rv2]),[n,rv1,rv2,rm1,rm2]),[1,2,4,3,5]);</span>
0053 <span class="keyword">end</span> 
0054 <span class="keyword">return</span>
0055 <span class="keyword">end</span></pre></div>
<hr><address>Generated on Wed 08-Feb-2012 18:20:24 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>